//package filter;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//@WebServlet(urlPatterns = {"/","/index"})
//public class CheckLoginFilter implements Filter {
//    public void init(FilterConfig filterConfig) throws ServletException {
//
//    }
//
//    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
//        HttpServletRequest req = (HttpServletRequest) request;
//        HttpServletResponse resp = (HttpServletResponse) response;
//        System.out.println("经过过滤器");
//        Object obj = req.getSession().getAttribute("admin_user");
//        if (obj != null){
//            chain.doFilter(request,response);
//        }else {
//            resp.sendRedirect("/login");
//        }
//    }
//
//    public void destroy() {
//
//    }
//}
